﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DatabaseModule
{
    public enum ConditionMode
    {
        ModeAnd,
        ModeOr,
        ModeTopLevelOr,
        ModeTopLevelAnd
    }

    public class KeyValues
    {
        private List<KeyValuePair<string, string>> internalMappings;
        private List<ConditionMode> modeMappings;

        public KeyValues()
        {
            internalMappings = new List<KeyValuePair<string, string>>();
            modeMappings = new List<ConditionMode>();
        }

        public void Add(string key, string value, ConditionMode mode = ConditionMode.ModeOr)
        {
            internalMappings.Add(new KeyValuePair<string, string>(key, value));
            modeMappings.Add(mode);
        }

        /*
        public string this[string index]
        {
            get
            {
                return internalMappings[index].Value;
            }

            set
            {
                internalMappings[index] = value;
            }
        }
        */

        /*
        public Dictionary<string, string> GetMapping()
        {
            return internalMappings;
        }
        */

        public ConditionMode GetMode(int index)
        {
            return modeMappings[index];
        }

        public int Count
        {
            get
            {
                return internalMappings.Count;
            }
        }

        public List<string> Keys
        {
            get
            {
                List<string> keys = new List<string>();

                foreach (KeyValuePair<string, string> item in internalMappings)
                {
                    keys.Add(item.Key);
                }

                return keys;
            }
        }

        public List<string> Values
        {
            get
            {
                List<string> values = new List<string>();

                foreach (KeyValuePair<string, string> item in internalMappings)
                {
                    values.Add(item.Value);
                }

                return values;
            }
        }

    }
}
